<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
    <h1>发布微博</h1>
    <input type="text" placeholder="说点儿什么..." v-model="content">
    <input type="button" value="发布" @click="insert()">
</div>

<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>
<script>

        let v=new Vue({
                el:"body>div",
                data:{
                    content:""

                },
                methods:{
                    insert(){
                        console.log(1111111111)
                        axios.get("/insert?content="+v.content).then(function (response) {
                            if(response.data==1){
                            alert("发布完成！");
                            location.href="/";
                            }else {
                                alert("请先登录！")
                                location.href="/login.html"
                            }
                        })
                    }

                }
            })



</script>
</body>
</html>